package com.lwc.backendsinglestructure.exception;

import lombok.Getter;

/**
 * 错误状态码
 */
@Getter
public enum ErrorCode {

    // =============== 系统错误状态码 ===============
    SUCCESS(0, "ok"),
    PARAMS_ERROR(40000, "请求参数错误"),
    NOT_LOGIN_ERROR(40100, "未登录"),
    NO_AUTH_ERROR(40101, "无权限"),
    NOT_FOUND_ERROR(40400, "请求数据不存在"),
    FORBIDDEN_ERROR(40300, "禁止访问"),
    SYSTEM_ERROR(50000, "系统内部异常"),
    OPERATION_ERROR(50001, "操作失败"),
    REPEAT_CAPTCHA_ERROR(50002, "一分钟内请勿重新发送"),

    // =============== 用户错误状态码 ===============
    USER_NOT_FOUND_ERROR(30000, "用户不存在"),
    PASSWORD_ERROR(30001, "密码与确认密码不一致"),
    CODE_ERROR(30002, "验证码错误"),
    PHONE_NOT_FOUND_ERROR(30003, "手机号不能为空"),
    USERNAME_REPEAT_ERROR(30004, "用户名已存在"),
    PHONE_REPEAT_ERROR(30005, "该手机号已注册"),
    CAPTCHA_ERROR(30006, "验证码不正确"),
    SEND_CAPTCHA_ERROR(30007, "发送验证码失败"),
    EMAIL_ERROR(30008, "邮箱格式错误"),
    PHONE_ERROR(30009, "手机格式错误"),
    USERNAME_NOT_FOUND_ERROR(30010, "用户名不能为空");
    /**
     * 状态码
     */
    private final int code;

    /**
     * 信息
     */
    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

}